﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class teacher
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _teacher_id = -99;
        private string _teacher_name = "";
        private string _date_of_birth = "";
        private string _date_of_join = "";
        private string _gender = "";
        private string _photo = "";
        private string _permanent_address = "";
        private long _residence_pno = -99;
        private long _mobile_pno = -99;
        private long _user_type_id = -99;
        private string _username = "";
        private string _password = "";
        private string _teacher_emailid = "";
        private string _security_question = "";
        private string _answer = "";
        private bool _isdeleted = false;
        public long teacher_id
        {
            get
            {
                return _teacher_id;
            }
            set
            {
                _teacher_id = value;
            }
        }
        public string teacher_name
        {
            get
            {
                return _teacher_name;
            }
            set
            {
                _teacher_name = value;
            }
        }
        public string date_of_birth
        {
            get
            {
                return _date_of_birth;
            }
            set
            {
                _date_of_birth = value;
            }
        }
        public string date_of_join
        {
            get
            {
                return _date_of_join;
            }
            set
            {
                _date_of_join = value;
            }
        }
        public string gender
        {
            get
            {
                return _gender;
            }
            set
            {
                _gender = value;
            }
        }
        public string photo
        {
            get
            {
                return _photo;
            }
            set
            {
                _photo = value;
            }
        }
        public string permanent_address
        {
            get
            {
                return _permanent_address;
            }
            set
            {
                _permanent_address = value;
            }
        }
        public long residence_pno
        {
            get
            {
                return _residence_pno;
            }
            set
            {
                _residence_pno = value;
            }
        }
        public long mobile_pno
        {
            get
            {
                return _mobile_pno;
            }
            set
            {
                _mobile_pno = value;
            }
        }
        public long user_type_id
        {
            get
            {
                return _user_type_id;
            }
            set
            {
                _user_type_id = value;
            }
        }
        public string username
        {
            get
            {
                return _username;
            }
            set
            {
                _username = value;
            }
        }
        public string password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
            }
        }
        public string security_question
        {
            get
            {
                return _security_question;
            }
            set
            {
                _security_question = value;
            }
        }
        public string answer
        {
            get
            {
                return _answer;
            }
            set
            {
                _answer = value;
            }
        }
        public string teacher_emailid
        {
            get
            {
                return _teacher_emailid;
            }
            set
            {
                _teacher_emailid = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@teacher_id", teacher_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@teacher_name", teacher_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@date_of_birth", date_of_birth, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@date_of_join", date_of_join, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@gender", gender, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@photo", photo, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@teacher_emailid", teacher_emailid, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@residence_pno",residence_pno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@mobile_pno", mobile_pno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6,dbparam7,  dbparam8, dbparam9,dbparam10, dbparam11, dbparam12,dbparam13,dbparam14,dbparam15 };
                return DAC.Save("teacher_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long teacher_id, string teacher_name, string date_of_birth, string date_of_join, string gender, string photo, string permanent_address,  long residence_pno, long mobile_pno, long user_type_id,string username,string password,string teacher_emailid,string security_question,string answer, bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@teacher_id", teacher_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@teacher_name", teacher_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@date_of_birth", date_of_birth, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@date_of_join", date_of_join, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@gender", gender, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@photo", photo, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@teacher_emailid", teacher_emailid, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@residence_pno", residence_pno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@mobile_pno", mobile_pno, DbType.Int64, ParameterDirection.Input);
                //DbParameter dbparam10 = DAC.Parameter("@registration_id", registration_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam12, dbparam13,dbparam14,dbparam15,dbparam16 };
                DataTable dt1 = DAC.Select("teacher_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}

